﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using BesAsm.Stormwater.HspfCore;

namespace BesAsm.Stormwater.HspfResults
{
  public class PerlandSegmentResults : LandSegmentResults
  {
    public PerlandSegmentResults(LandSegment segment)
      : base(segment)
    {
    }

    public PerlandSegmentResults(int segmentNum, string segmentName)
      : base(segmentNum, segmentName)
    {      
    }

    private DataColumn[] GetColumns()
    {
      DataColumn[] columns = new DataColumn[] 
      { 
        new DataColumn("Date", typeof(DateTime)),
        new DataColumn("SUPY", typeof(double)),
        new DataColumn("SURO", typeof(double)),
        new DataColumn("IFWO", typeof(double)),
        new DataColumn("AGWO", typeof(double)),
        new DataColumn("PERO", typeof(double)),
        new DataColumn("IGWI", typeof(double))
      };

      return columns;

    }

    public override DataTable GetDataTable()
    {
      DataTable dt = new DataTable(this.Name);
      dt.Columns.AddRange(this.GetColumns());      

      foreach (L61Block block in this)
      {
        DataRow row = dt.NewRow();

        row.ItemArray = new object[] 
        {
          block.ResultsDate,
          block.Fluxes.Supy,
          block.Fluxes.Suro,
          block.Fluxes.Ifwo,
          block.Fluxes.Agwo,
          block.Fluxes.Pero,
          block.Fluxes.Igwi
        };
        
        dt.Rows.Add(row);
      }
    
      return dt;
    }

    public override SegmentType Type
    {
      get { return SegmentType.Perland; }
    }
  }
}
